﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Idlesoft.Utils;

namespace Idlesoft.ShellAnywhereLanguage
{
	public static class TypeValueExtensions
	{
		public static bool IsTypeValue(this TypeValue type, TypeValue test)
		{
			return type.Value.Equals(test.Value) && type.Type.IsType(test.Type);
		}
	}
	public class TypeValue //: ITypeValue
	{
		public TypeValue(string value) : this(null, value) { }
		public TypeValue(Type type, string value) { Type = type != null ? type : this.GetType(); Value = value; }
		public Type Type { get; internal set; }
		public string Value { get; internal set; }
		public override bool Equals(object obj)
		{
			TypeValue tv = (TypeValue)obj;
			return tv != null ? this.Type.Equals(tv.Type) && this.Value.Equals(tv.Value) : false;
		}
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}
	}
}
